extends IInputAction


class_name InputMouseMotion


## 鼠标滚动类型
@export_flags("LEFT:1", "RIGHT:2", "MIDDLE:4", "MB_XBUTTON1:128", "MB_XBUTTON2:256") var button_mask: int = 0


func __get_mouse(e: InputEvent) -> InputEventMouseMotion:
    if e is InputEventMouseMotion:
        var mouse: InputEventMouseMotion = e as InputEventMouseMotion
        if (mouse.button_mask & button_mask) != 0:
            return mouse
    return null

func __is_input_pressed(e: InputEvent) -> bool:
    var mouse: InputEventMouseMotion = __get_mouse(e)
    if mouse:
        return mouse.is_pressed()
    return false

func __is_input_released(e: InputEvent) -> bool:
    var mouse: InputEventMouseMotion = __get_mouse(e)
    if mouse:
        return mouse.is_released()
    return false
